#include <iostream>
using namespace std;

int main() {
    int a;
    cin >> a;
    cout << (a == 5 ? 7 : (a + 2) % 7);
    return 0;
}